import React from 'react'

import { push } from './redux/actions'

/**
 function useDisaptch(){
  return store.dispatch
 }
 */
import { useSelector, useDispatch } from 'react-redux'
export default function XXX() {
  console.log('xxx组件更新了')

  const xxx = useSelector((state) => {
    return state.zs.xxx
  })
  // 返回store.dispatch函数
  const dispatch = useDispatch()
  return (
    <div>
      <button
        onClick={() => {
          dispatch(push(9))
        }}
      >
        xxx按钮
      </button>
      <ul>
        {xxx.map((item, index) => {
          return <li key={index}>{item}</li>
        })}
      </ul>
    </div>
  )
}
